import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import java.awt.Font;


public class EIIdazkari extends JFrame {

	private JPanel contentPane;
	private JButton btnHitzorduakKudeatu;
	private JButton btnBezeroakKudeatu;
	private JButton btnLogout;
	private JButton btnTerapeutakKudeatu;
	private JPasswordField passwordField;

	public EIIdazkari() {
		elementuakHasieratu();
		botoiakHasieratu();
		setVisible(true);
	}
	
	public void elementuakHasieratu(){
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 900, 600);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		btnHitzorduakKudeatu = new JButton("Hitzorduak kudeatu");
		btnHitzorduakKudeatu.setBounds(310, 98, 214, 55);
		contentPane.add(btnHitzorduakKudeatu);
		
		btnBezeroakKudeatu = new JButton("Bezeroak kudeatu");
		btnBezeroakKudeatu.setBounds(310, 205, 214, 62);
		contentPane.add(btnBezeroakKudeatu);
		
		JLabel lblIdazkaria = new JLabel("IDAZKARIA");
		lblIdazkaria.setFont(new Font("Dialog", Font.BOLD, 18));
		lblIdazkaria.setBounds(369, 39, 112, 30);
		contentPane.add(lblIdazkaria);
		
		btnLogout = new JButton("Logout");
		btnLogout.setBounds(795, 12, 85, 25);
		contentPane.add(btnLogout);
		
		btnTerapeutakKudeatu = new JButton("Terapeutak kudeatu");
		btnTerapeutakKudeatu.setBounds(310, 323, 214, 62);
		contentPane.add(btnTerapeutakKudeatu);
		
	}
	
	public void botoiakHasieratu(){
		
		//Hitzorduak kudeatu
		
		btnHitzorduakKudeatu.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
		
				EIHitzorduKudeatzailea frame = new EIHitzorduKudeatzailea();
				EIIdazkari.this.dispose();
				
			}
		});
		
		//Bezeroak kudeatua
		
		btnBezeroakKudeatu.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				EIBezeroKudeatzailea frame = new EIBezeroKudeatzailea();
				EIIdazkari.this.dispose();
			
			}
		});
		
		// Hasierara
		
		btnLogout.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				EILogin frame = new EILogin();
				EIIdazkari.this.dispose();
			}
		});
		
		btnTerapeutakKudeatu.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				EventQueue.invokeLater(new Runnable() {
					public void run() {
						try {
							EITerapeutakKudeatu frame = new EITerapeutakKudeatu();
							EIIdazkari.this.dispose();
						} catch (Exception e) {
							e.printStackTrace();
						}
					}
				});
			}
		});
		
		
	}
}
